<template>
  <div class="edit-container">
    <el-descriptions title="个人信息：" :column="3" border direction="vertical">
      <el-descriptions-item labelStyle="font-weight: bold" label="姓名">{{ tableData.personalInformationModel.name }}
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="性别">
        {{ tableData.personalInformationModel.sex === 1? '男' : '女' }}
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="⼿机号">{{ tableData.personalInformationModel.phone }}
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="身份证号">
        {{ tableData.personalInformationModel.idCards }}
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="毕业学校">{{
          tableData.personalInformationModel.school
        }}
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="毕业时间">
        {{ tableData.personalInformationModel.graduationTime }}
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="毕业证">
        <el-image
          style="width: 100px; height: 100px"
          :src="tableData.personalInformationModel.graduationUrl"
          :preview-src-list="[tableData.personalInformationModel.graduationUrl]">
        </el-image>
      </el-descriptions-item>

      <el-descriptions-item labelStyle="font-weight: bold" label="银行账号">
        {{ tableData.personalInformationModel.bankNum }}
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="银行名称">{{
          tableData.personalInformationModel.bank
        }}
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="人社局个人信息审核：" >
          {{
            tableData.personalInformationModel.state === 2 ? '待审核' :
              tableData.personalInformationModel.state === 1 ? '通过' :
                '未通过'
          }}
      </el-descriptions-item>
      <el-descriptions-item  labelStyle="font-weight: bold" label="拒绝原因：" v-if="tableData.personalInformationModel.state === 0">
        {{ tableData.personalInformationModel.reason }}
      </el-descriptions-item>
    </el-descriptions>

    <el-descriptions title="企业信息：" :column="3" border
                     direction="vertical"
                     style="margin-top: 20px">
      <el-descriptions-item labelStyle="font-weight: bold" label="企业名称">
        {{ tableData.enterpriseInformationModel.ename }}
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="纳税人识别号">
        {{ tableData.enterpriseInformationModel.taxpayerIdentificationNumber }}
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="所在部门">
        {{ tableData.enterpriseInformationModel.department }}
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="岗位名称">
        {{ tableData.enterpriseInformationModel.postName }}
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="企业联系电话">
        {{ tableData.enterpriseInformationModel.ephone }}
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="是否全勤">
        <template>
          <div v-if="tableData.enterpriseInformationModel.fullAttendance ===1">是</div>
          <div v-else>否</div>
        </template>
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="在职证明">
        <el-image
          style="width: 100px; height: 100px"
          :src="tableData.enterpriseInformationModel.proofOfMployment"
          :preview-src-list="[tableData.enterpriseInformationModel.proofOfMployment]">
        </el-image>
      </el-descriptions-item>
      <el-descriptions-item labelStyle="font-weight: bold" label="考勤明细（图片）">
        <el-image
          style="width: 100px; height: 100px"
          :src="tableData.enterpriseInformationModel.attendanceEtails"
          :preview-src-list="[tableData.enterpriseInformationModel.attendanceEtails]">
        </el-image>
      </el-descriptions-item>

      <el-descriptions-item labelStyle="font-weight: bold" label="人社局企业信息审核：" >
        {{
          tableData.enterpriseInformationModel.state === 2 ? '待审核' :
            tableData.enterpriseInformationModel.state === 1 ? '通过' :
              '未通过'
        }}
      </el-descriptions-item>
      <el-descriptions-item  labelStyle="font-weight: bold" label="拒绝原因：" v-if="tableData.enterpriseInformationModel.state === 0">
        {{ tableData.enterpriseInformationModel.reason }}
      </el-descriptions-item>

    </el-descriptions>

    <el-form v-loading="saveLoading" ref="form" :model="form" :rules="rules" label-width="150px">

      <el-form-item label="拒绝原因：" prop="reason" v-if="form.subsidyApplicationDetailsModel.subsidyState=== 4 ">
        <el-input v-model="form.subsidyApplicationDetailsModel.reason" maxlength="150" placeholder="拒绝原因"
                  type="textarea" :rows="3"/>
      </el-form-item>

    </el-form>
  </div>
</template>
<script>


import {
  getBySubsidyApplicationId,
  updateListDateStatus,
  updateStatusPOrE
} from "@/api/subsidyApplication";

export default {
  components: {},
  props: {
    isCreate: {
      type: Number,
      required: true
    },
    editData: {
      type: Object,
      default: () => {
        return {rules: []}
      }
    },
  },
  data() {
    return {
      tableData: {
        enterpriseInformationModel: [], personalInformationModel: [], subsidyApplicationDetailsModel: []
      },
      form: {
        id: null,
        state: '',

        subsidyApplicationDetailsModel: {
          subsidyState: '',
          reason: '',
        },
        subsidyApplicationModel: {
          applicationState: '',
        },

        personalInformationModel: {
          state: '',
          reason: '',
        },
        enterpriseInformationModel: {
          state: '',
          reason: '',
        },

      },
      rules: {
      },
      saveLoading: false,
    }
  },

  mounted() {
    this.getDetail();
  },

  methods: {

    //获取列表
    getDetail() {
      this.saveLoading = true

      getBySubsidyApplicationId({
        subsidyApplicationId: this.editData.id

      }).then((res) => {
        this.tableData = res
        this.form.personalInformationModel = res.personalInformationModel
        this.form.enterpriseInformationModel = res.enterpriseInformationModel
        this.form.subsidyApplicationModel.applicationState = res.subsidyApplicationModel.applicationState
      }).finally(() => {
        this.saveLoading = false;
      })
    },

  }
}
</script>

